<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    #dl{
        width: 300px;
        height: 200px;
        margin: 50px auto;
        background-color: #eee;
        padding: 30px;
    }
  
</style>
</head>

<body>
<div id="dl">
    <div   >用户名:<input type="text"  id="yhm" > </div>
    <div>密码:&nbsp;&nbsp;&nbsp;<input type="password" id="mm"> </div>
    <button id="an">登录</button>
</div>
<script>
    var ymh=document.getElementById('yhm');
    var mm=document.getElementById('mm');
    var an=document.getElementById('an');

    an.onclick=function(){
      
      if(ymh.value!='张三'){
        alert('用户名错误')
      }      
      else if(mm.value!='123456'){
        alert('密码错误')
      } 
      else{
        location='https://www.imooc.com/?mc_marking=16bee994c7ccca8ed8f6747c1405d1ef&mc_channel=bdocpc1&sem=1?utm_source=baidu-pc&utm_medium=sem1&utm_campaign=brand-xg&utm_content=home&utm_term=%C6%B7%C5%C6%CF%E0%B9%D8&bd_vid=6692610711340819423';}
        
    }
</script>
</body>

</html>